Skip to content

Add GitHub Copilot agent setup workflow#1543

Merged
pelikhan merged 5 commits into
mainfrom
copilot/add-copilot-agent-env-file
Oct 11, 2025
Merged

Add GitHub Copilot agent setup workflow#1543
pelikhan merged 5 commits into
mainfrom
copilot/add-copilot-agent-env-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 11, 2025

This PR adds a .github/workflows/copilot-setup-steps.yml workflow file to configure the GitHub Copilot coding agent environment with preinstalled tools and dependencies.

Overview

The workflow follows the GitHub documentation for customizing the agent environment and mirrors the setup steps from our CI workflow's build job.

Workflow Structure

The workflow is configured as a proper GitHub Actions workflow with:

  • Name: "Copilot Setup Steps"
  • Job Name: copilot-setup-steps (required by GitHub Copilot)
  • Triggers: workflow_dispatch, push, and pull_request (on changes to the workflow file itself)
  • Permissions: contents: read (minimal permissions needed for setup)
  • Runs on: ubuntu-latest

Setup Steps

The workflow includes the following setup steps:

  1. Checkout code - Clones the repository
  2. Node.js Setup - Sets up Node.js version 24 with npm caching for pkg/workflow/js/package-lock.json
  3. Go Setup - Sets up Go using the version specified in go.mod with caching enabled
  4. Install JavaScript dependencies - Installs JavaScript dependencies in pkg/workflow/js/
  5. Install development dependencies - Runs make deps-dev to install development tools (golangci-lint, actionlint, prettier, GitHub Actions schema)
  6. Build - Runs make build with continue-on-error: true to ensure environment setup completes even if the build fails

Benefits

This configuration will:

  • Provide Copilot agents with a fully configured development environment
  • Speed up agent workflows by preinstalling necessary tools
  • Ensure agents have access to built binaries and dependencies when assisting with code changes
  • Install all development dependencies (linters, schema files, etc.) needed for full development capabilities
  • Allow the build step to fail gracefully without blocking the agent from providing assistance
  • Enable easy validation through manual testing in the repository's "Actions" tab

The continue-on-error: true flag on the build step ensures that if there are existing build issues in the repository, the agent can still operate and provide help rather than failing during environment setup.

Original prompt

Add a GitHub copilot agent workflow environment file as documented in https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#preinstalling-tools-or-dependencies-in-copilots-environment

Use the same steps as ci.yml build job to configure (don't fail on failed build step)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add workflow environment file for GitHub Copilot agent Add GitHub Copilot agent environment file Oct 11, 2025
Copilot AI requested a review from pelikhan October 11, 2025 15:24
@pelikhan
Copy link
Copy Markdown
Collaborator

Here is a template for typescript, notice how the structure is different. Adjust workflow accordingly and review the docs again.

name: "Copilot Setup Steps"

Automatically run the setup steps when they are changed to allow for easy validation, and

allow manual testing through the repository's "Actions" tab

on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:

The job MUST be called copilot-setup-steps or it will not be picked up by Copilot.

copilot-setup-steps:
runs-on: ubuntu-latest

# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
  # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
  contents: read

# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
  - name: Checkout code
    uses: actions/checkout@v5

  - name: Set up Node.js
    uses: actions/setup-node@v4
    with:
      node-version: "20"
      cache: "npm"

  - name: Install JavaScript dependencies
    run: npm ci

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot apply comments

…ows/

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 11, 2025

Here is a template for typescript, notice how the structure is different. Adjust workflow accordingly and review the docs again.

name: "Copilot Setup Steps"...

Fixed in commit. The file is now a proper GitHub Actions workflow at .github/workflows/copilot-setup-steps.yml with:

  • Correct job name copilot-setup-steps
  • Workflow triggers (workflow_dispatch, push, pull_request)
  • Proper permissions structure
  • All setup steps from ci.yml build job (with continue-on-error on build)

Copilot AI changed the title Add GitHub Copilot agent environment file Add GitHub Copilot agent setup workflow Oct 11, 2025
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot add "make dev-deps" step before build

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 11, 2025

@copilot add "make dev-deps" step before build

Added make deps-dev step before the build step. This installs development dependencies including golangci-lint and runs npm ci for the JavaScript workspace.

@pelikhan pelikhan marked this pull request as ready for review October 11, 2025 16:01
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@pelikhan pelikhan merged commit 84fbe28 into main Oct 11, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/add-copilot-agent-env-file branch October 11, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants